<include file="Public/common1" />
<block name="css">
    <link rel="stylesheet" type="text/css" href="__CSS__/index/order_detail.css">
    <style type="text/css">
        .warp{ padding: 10px;border:1px solid #ddd; }
        .btn-info{  margin: 0 10px 10px 0; }
        .info-warp { padding-bottom: 0; }
        .info-warp .border{ top: 10px;}
        .info-title{
            font-weight: bolder;
            font-size: medium;
            margin: 10px 0;
            text-indent: 10rem;
        }
    </style>
</block>
<block name="content">
<form id="form" method="post" action="/Reseller/OrderCenter/orderChange">
    <input type="hidden" value="{$order['order_id']}" name="order_id"/>
    <ul class="navs clearfix">
          <li class="active" style="border-left: 1px solid #ddd;"><span class="icon">&#10004;</span><a>第一步<br/>选择线路</a></li>
          <li class="active"><span class="icon">&#10004;</span><a >第二步<br/>行程预览</a></li>
          <li class="active"><span class="icon">&#10004;</span><a >第三步<br/>游客信息录入</a></li>
          <li class="active"><span class="icon">4</span><a >订单详情预览</a></li>
    </ul>
    <div class="warp clearfix">
        <h4>订单信息</h4>
        <section class="order-detail container">
            <div class="row">
                <div class="col-xs-2 text-right border ">订单状态：</div>
                <div class="col-xs-4 ">预约成功(待出团)</div>
                <div class="col-xs-2 text-right border ">线路名称：</div>
                <div class="col-xs-4 ">{$order['line_name']}</div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-right border ">订单号：</div>
                <div class="col-xs-4 ">{$order['order_num']}</div>
                <div class="col-xs-2 text-right border">出团日期：</div>
                <div class="col-xs-4 ">{$order['out_time']|date='Y-m-d', ###}</div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-right border">下单时间：</div>
                <div class="col-xs-4 ">{$order['create_time']|date='Y-m-d',###}</div>
                <div class="col-xs-2 text-right border">出游人数：</div>
                <div class="col-xs-4 ">{$order['total_num']}</div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-right border">联系人：</div>
                <div class="col-xs-4 ">{$tourist['0']['tourists_name']}({$tourist['0']['tourists_phone']})</div>
                <div class="col-xs-2 text-right border">团号：</div>
                <div class="col-xs-4 ">{$order['group_num']}</div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-right border">订单备注：</div>
                <div class="col-xs-4 ">{$order['order_remarks']}</div>
            </div>
        </section>

    <!--     <h4>支付明细</h4>
        <section class="order-detail container">
            <div class="row">
                <div class="col-xs-2 text-right border ">订单总额：</div>
                <div class="col-xs-2 text-right"></div>
                <div class="col-xs-2 text-right border ">实收金额：</div>
                <div class="col-xs-2 text-right"></div>
                <div class="col-xs-2 text-right border ">未收金额：</div>
                <div class="col-xs-2 text-right"></div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-right border ">实际可退金额：</div>
                <div class="col-xs-2 text-right"></div>
                <div class="col-xs-2 text-right border">退款金额：</div>
                <div class="col-xs-2 text-right"></div>
            </div>
        </section> -->



        <ul id="nav" class="nav nav-tabs">
          <!-- <li role="presentation" ><a href="javascript:void(0)">退款</a></li> -->
          <li role="presentation" class="active"><a href="javascript:void(0)">收款明细</a></li>
        </ul>
        <!-- 退款 -->
       <!--  <section class="clearfix" id="refund">
            <div class="col-xs-12 clearfix mt-15">
                <label class="col-xs-2 border text-right">实收金额：</label>
                <div class="col-xs-8">
                    <div class="input-group">
                        <span class="input-group-addon">&#165;</span>
                        <input type="number" name="back_end" class="form-control" placeholder="">
                    </div>
                </div>
            </div>

            <div class="col-xs-12 clearfix mt-15">
                <label class="col-xs-2 border text-right">可退金额：</label>
                <div class="col-xs-8">
                    <div class="input-group">
                        <span class="input-group-addon">&#165;</span>
                        <input type="number" name="back_money" class="form-control" placeholder="">
                    </div>
                </div>
            </div>

        </section> -->

        <!-- 收款明细 -->
        <section class="clearfix" id="income">
            <div class="col-xs-12 clearfix mt-15">
                <label class="col-xs-2 border text-right">实收金额：</label>
                <div class="col-xs-8">
                    <div class="input-group">
                        <span class="input-group-addon">&#165;</span>
                        <input type="number" id="closeMoney" name="end_need_pay" class="form-control" placeholder="">
                    </div>
                </div>
            </div>

            <div class="col-xs-12 clearfix mt-15">
                <label class="col-xs-2 border text-right">结算金额：</label>
                <div class="col-xs-8">
                    <div class="input-group">
                        <span class="input-group-addon">&#165;</span>
                        <input type="text" id="needPay" name="need_pay" readonly value="{$order['need_pay']}" class="form-control" placeholder="">
                    </div>
                </div>
            </div>

            <div class="col-xs-12 clearfix mt-15">
                <label class="col-xs-2 border text-right">其他毛利：</label>
                <div class="col-xs-8">
                    <div class="input-group">
                        <span class="input-group-addon">&#165;</span>
                        <input type="text" readonly id="profits" class="form-control" placeholder="">
                    </div>
                </div>
            </div>
        </section>

        <!-- 发票明细 -->
        <h4>发票明细</h4>
        <section>
            <div class="row">
                    <div class="col-xs-2 text-right border ">发票代码：</div>
                    <div class="col-xs-4 "><input class="form-control" type="text" name="receipt_code" id="receiptCode" /></div>
                    <div class="col-xs-2 text-right border ">发票号码：</div>
                    <div class="col-xs-4 "><input class="form-control" type="text" name="receipt_num" id="receiptNum" /></div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-right border ">发票金额：</div>
                <div class="col-xs-4 "><input class="form-control" type="text" name="receipt_amount" id="receiptAmount" /></div>
                <div class="col-xs-2 text-right border">开具人：</div>
                <div class="col-xs-4 "><input class="form-control" type="text" name="open_user" id="openUser" /></div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-right border">发票抬头：</div>
                <div class="col-xs-4 "><input class="form-control" type="text" name="receipt_rise" id="receiptRise" /></div>
                <div class="col-xs-2 text-right border">发票内容：</div>
                <div class="col-xs-4 "><input class="form-control" type="text" name="receipt_content" id="receiptContent" /></div>
            </div>

            <div class="row">
                <div class="col-xs-2 text-right border">备注：</div>
                <div class="col-xs-4 "><input class="form-control" type="text" name="remarks" id="remarks" /></div>
            </div>
        </section>
        <section class="info-warp">
            <h4>交通服务</h4>
            <div class="col-xs-12 clearfix info-title">
                <div class="col-xs-6">交通 标准</div>
                <div class="col-xs-6">交通 升级</div>
            </div>
            <div class="col-xs-12 clearfix">
                <!-- 标准交通方式去 -->
                <div class="col-xs-6">
                    <if condition="$traffic['go']">
                        <div class="col-xs-2 text-right border">{$go_traffic_name}(去)：</div>
                        <div class="col-xs-10">
                            <a class="btn btn-info">{$traffic['go']['seat_name']}<br/>成人 * {$traffic['go']['adult_count']} &nbsp; 儿童：{$traffic['go']['child_count']}</a>
                        </div>
                    </if>
                </div>
                 <!-- 升级交通方式去 -->
                <div class="col-xs-6">
                    <if condition="$up_traffic['go']">
                        <div class="col-xs-2 text-right border">(去)：</div>
                        <div class="col-xs-10">
                            <foreach name="up_traffic['go']" item="v">
                                <a class="btn btn-info">{$v['seat_name']}<br/>成人 * {$v['adult_count']} &nbsp; 儿童：{$v['child_count']}</a>
                            </foreach>
                        </div>
                    </if>
                </div>
            </div>

            <!-- 标准交通方式回 -->
            <div class="col-xs-12 clearfix">
                <div class="col-xs-6">
                    <if condition="$traffic['back']">
                        <div class="col-xs-2 text-right border">{$go_traffic_name}(回)：</div>
                        <div class="col-xs-10">
                            <a class="btn btn-info">{$traffic['back']['seat_name']}<br/>成人 * {$traffic['back']['adult_count']} &nbsp; 儿童：{$traffic['back']['child_count']}</a>
                        </div>
                    </if>
                </div>
                <!-- 升级交通方式回 -->
                <if condition="$up_traffic['back']">
                    <div class="col-xs-6">
                        <div class="col-xs-2 text-right border">(回)：</div>
                        <div class="col-xs-10">
                            <foreach name="up_traffic['back']" item="v">
                                <a class="btn btn-info">{$v['seat_name']}<br/>成人 * {$v['adult_count']} &nbsp; 儿童：{$v['child_count']}</a>
                            </foreach>
                        </div>
                    </div>
                </if>
            </div>



            <h4>酒店服务</h4>
                <div class="col-xs-12 clearfix info-title">
                    <div class="col-xs-6">酒店 标准</div>
                    <div class="col-xs-6">酒店 升级</div>
                </div>
                <foreach name="hotel" key="k" item="v">
                    <!-- 每天标准酒店 -->
                    <div class="col-xs-12 clearfix ">
                        <div class="col-xs-6">
                            <div class="col-xs-2 text-right border">{$k}：</div>
                            <div class="col-xs-10">
                                <foreach name="v['standrand']" item="standrand">
                                    <a class="btn btn-info">{$standrand['supplier_name']}<br/>{$standrand['room_name']} * {$standrand['room_count']}</a>
                                </foreach>
                            </div>
                        </div>
                        <!-- 每天升级酒店 -->
                        <if condition="$v['up']">
                            <div class="col-xs-6">
                                <div class="col-xs-2 text-right border">{$k}：</div>
                                <div class="col-xs-10">
                                    <foreach name="v['up']" item="up">
                                        <a class="btn btn-info">{$up['supplier_name']}<br/>{$up['room_name']} * {$up['room_count']}</a>
                                    </foreach>
                                </div>
                            </div>
                        </if>

                    </div>

                </foreach>
            <h4>附加产品</h4>
            <div class="col-xs-12 clearfix mt-10" >

                <foreach name="product" item="v">
                    <a class="btn btn-info">{$v['product_name']}</a>
                </foreach>
            </div>
            <h4>其他</h4>
            <div class="col-xs-12 clearfix mt-10" >
                <!-- 保险 -->
                <if condition="$insure">
                    <a class="btn btn-info">保险<br/>{$v['insure_name']}</a>
                </if>
                <!-- 签证 -->
                <if condition="$order['visa_price'] gt 0">
                    <a class="btn btn-info">签证</a>
                </if>
            </div>
        </section>
        <h4>游客信息</h4>
        <table class="table table-striped table-bordered table-hover table-condensed  mt-15">
            <thead>
                <tr>
                    <!-- <th class="add">+</th> -->
                    <!-- <th>子订单号</th> -->
                    <!-- <th>游客状态</th> -->
                    <th>游客</th>
                    <th>游客个人信息</th>
                    <th>备注</th>
                    <!-- <th>操作</th> -->
                </tr>
            </thead>
            <tbody>
                <foreach name="tourist" item="v">
                <tr>
                    <!-- <td ></td> -->
                    <!-- <td>1231521231231231</td> -->
                    <!-- <td><span class="label label-success">生效</span></td> -->
                    <td>{$v['tourists_type']}
                        <if condition="$v['is_contact'] == 1"><span class="label label-danger">联系人</span></if>
                    </td>
                    <td>
                        姓名：{$v['tourists_name']}<br/>
                        性别：{$v['tourists_sex']}<br/>
                        {$v['documents_type']}：{$v['documents_num']}<br/>
                        手机：{$v['tourists_phone']}<br/>
                        地址：{$v['tourists_address']}
                    </td>
                    <td>{$v['tourists_remarks']}</td>
                    <!-- <td>
                        <button class="btn btn-danger">删除</button>
                    </td> -->
                </tr>
                </foreach>
            </tbody>
        </table>
        <div class="col-xs-12 text-center mt-15">
            <input type="button" onclick="submitForm()" value="完成" class="btn btn-primary btn-large" />
        </div>
    </div>
</form>
</block>
<block name="js">
<script>
// $('#nav').on('click', 'li', function(){
//     $(this).addClass('active').siblings().removeClass('active');
//     if($(this).index() == 0){
//         $('#refund').show();
//         $('#income').hide();
//     }else{
//         $('#income').show();
//         $('#refund').hide();
//     }
// })

var $profits = $('#profits'),
    $needPay = $('#needPay');
$('#closeMoney').on('change', function(){
    $profits.val((parseFloat($(this).val()) - parseFloat($needPay.val())).toFixed(2));
})

function submitForm(){
    $.post('{:U('orderChange')}', $('#form').serialize() ,function(data){
        if(data['status'] == 1){
            layer.msg('修改成功', {icon: 6});
            setTimeout(function(){
                location.href = '{:U('Index/orderDetail?order_id='.$order['order_id'])}';
            },1000)
        }else{
            layer.msg('修改失败', {icon: 5});
        }
    },'json')
}
</script>
</block>
